package com.base.cn.platform.os.service.manage.op.activity;


import com.base.cn.platform.os.entity.op.ActivityCodeCondition;
import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 促销活动接口
 * @author ll
 * @create 2018-05-10
 */
@FeignClient(name = BaseService.appName , configuration = FeignAuthConfig.class)
public interface OpActivityService extends BaseService {

    /**
     * 分页搜索促销活动
     * @param opActivity 活动
     * @param currentPage 当前页
     * @param courseData 课程数据  true 搜索  false 不搜索
     * @param couponData 优惠券数据  同上
     * @param createUserData 创建用户  同上
     * @return
     */
    @RequestMapping(contextPath + "/op/queryOpActivityListPage")
    Map<String,Object> queryOpActivityListPage(@RequestBody Map<String, Object> opActivity,
                                               @RequestParam("currentPage") Integer currentPage,
                                               @RequestParam("courseData") boolean courseData,
                                               @RequestParam("couponData") boolean couponData,
                                               @RequestParam("createUserData") boolean createUserData,
                                               @RequestParam("subjectData") boolean subjectData);


    /**
     * 分页搜索促销活动
     * @param opActivity 活动
     * @param courseData 课程数据  true 搜索  false 不搜索
     * @param couponData 优惠券数据  同上
     * @param createUserData 创建用户  同上
     * @return
     */
    @RequestMapping(contextPath + "/op/queryOpActivityList")
    List<Map<String,Object>> queryOpActivityList(@RequestBody Map<String, Object> opActivity,
                                                 @RequestParam("courseData") boolean courseData,
                                                 @RequestParam("couponData") boolean couponData,
                                                 @RequestParam("createUserData") boolean createUserData,
                                                 @RequestParam("subjectData") boolean subjectData);


    /**
     * 修改活动状态
     * @param activityIds
     * @param status
     * @return
     */
    @RequestMapping(contextPath + "/op/updateActivityStatusByIds")
    Map<String,Object> updateActivityStatusByIds(@RequestParam("activityIds") String activityIds,
                                                 @RequestParam("status") Integer status);


    /**
     * 发布促销活动
     * @param activityIds
     * @param releaseStatus
     * @return
     */
    @RequestMapping(contextPath + "/op/updateActivityReleaseStatusByIds")
    Map<String,Object> updateActivityReleaseStatusByIds(@RequestParam("activityIds") String activityIds,
                                                        @RequestParam("releaseStatus") Integer releaseStatus);

    /**
     * 订单查询可用的活动和优惠券数据
     * @param activityCodeCondition 查询条件
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/op/findOrderAvailableActivityAndCode")
    Map<String,Object> findOrderAvailableActivityAndCode(@RequestBody ActivityCodeCondition activityCodeCondition);

    /**
     * 添加修改促销活动
     * @param opActivity
     * @return
     */
    @RequestMapping(contextPath + "/op/toAddOrUpdateActivity")
    Map<String, Object> toAddOrUpdateActivity(@RequestBody Map<String, Object> opActivity);


    /**
     * 根据Id搜索促销活动
     * @param activityId
     * @param courseData
     * @param couponData
     * @param createUserData
     * @param subjectData
     * @return
     */
    @RequestMapping(contextPath + "/op/queryOpActivityById")
    Map<String,Object> queryOpActivityById(@RequestParam("activityId") BigDecimal activityId,
                                           @RequestParam("courseData") boolean courseData,
                                           @RequestParam("couponData") boolean couponData,
                                           @RequestParam("createUserData") boolean createUserData,
                                           @RequestParam("subjectData") boolean subjectData);

   /**
     * 查询订单可用的活动（只用于存课程商品的订单）
     * @param paramsList 限制条件
     * @param courseData 是否设置课程数据
     * @return List<OpActivity>
     */
    @RequestMapping(contextPath + "/op/findOrderAvailableActivityList")
    List<Map<String,Object>>  findOrderAvailableActivityList(@RequestBody List<Map<String, String>> paramsList,
                                                             @RequestParam("courseData") boolean courseData);
}
